﻿Namespace Yurtdisi.Hizmet
	Module Functions

		Function Oku(ByVal Token As Token, ByVal dosyano As String) As Recordset
			Return Token.OpenSQL("select * from ssdmerkez.dbo.ydhizmet where dosyano = @dosyano order by dosyano", dosyano)
		End Function

		Sub Sil(ByVal Token As Token, ByVal rowid As Integer)
			Token.ExecSQL("delete from ssdmerkez..ydhizmet where rowid = @rowid", rowid)
		End Sub

		Function YeniDosyaNo(ByVal Token As Token, ByVal harf As String) As String
			Dim sirano As Object
			sirano = Token.OpenSQL("select isnull(max(cast(substring(dosyano,2,5) as int)),0)+1 as maxno from ssdmerkez..ydhizmet where substring(dosyano,1,1) = @harf", harf)
			YeniDosyaNo = harf & CStr(sirano.currentRow.ItemArray(0))
		End Function

	End Module
End Namespace
